<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/reset.css">
    <style>
        .header {
            width: 1226px;
            margin: 0 auto;
        }

        .header .nav {
            line-height: 40px;
            font-size: 13px;
        }

        .header .nav>li {
            float: left;
            padding: 0 10px;
        }

        .header .nav>li>a+a {
            margin-left: 10px;
        }

        .hide {
            display: none;
        }
    </style>
</head>

<body>
    <div class="header">
        <ul class="nav clear">
            <li class="address">
                <a href="">中国大陆</a>
            </li>
            <li class="site-nav-sign">
                <a href="./html/login.html">亲,请登录</a>
                <a href="./html/register.html">免费注册</a>
            </li>
            <li class="site-nav-login hide">
                <a href="javascript:;" class="wel-tips">欢迎您,xxx</a>
                <a href="javascript:;" class="exit">退出</a>
            </li>
            <li>
                <a href="">手机淘宝</a>
            </li>
            <li>
                <a href="">网页无障碍</a>
            </li>
        </ul>
    </div>
</body>
<script type="module">
    import { getCookie, delCookie } from "./js/cookie.js";


    var siteNavSign = document.getElementsByClassName("site-nav-sign")[0];
    var siteNavLogin = document.getElementsByClassName("site-nav-login")[0];

    var lgc = getCookie("lgc");
    if (lgc) {
        siteNavSign.classList.add("hide");
        siteNavLogin.classList.remove("hide");

        var welTips = document.getElementsByClassName("wel-tips")[0];
        var exit = document.getElementsByClassName("exit")[0];

        welTips.textContent = `欢迎您,${lgc}`;

        exit.onclick = function () {
            delCookie("lgc");
            location.reload();
        }

    }

</script>

</html>